//
//  TurnOverItemizedTableViewCell.m
//  EasyToTesco2.0
//
//  Created by 袖手旁觀 on 16/6/23.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "TurnOverItemizedTableViewCell.h"

#define Margin 8

@implementation TurnOverItemizedTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
    }
    return self;
}

- (void)setItemizedDict:(NSDictionary *)itemizedDict {
    _itemizedDict = itemizedDict;
    
    [self loadTurnOverItemizedCellUI];
}

- (void)loadTurnOverItemizedCellUI {
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.text = [NSString stringWithFormat:@"姓名: %@",[_itemizedDict objectForKey:@"zhenming"]];
    nameLabel.font = [UIFont systemFontOfSize:13];
    nameLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(14.0)];
    [self.contentView addSubview:nameLabel];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).with.offset(Margin);
        make.top.equalTo(self.contentView.mas_top).with.offset(Margin);
        make.width.mas_equalTo(WIDTH * 0.3);
        make.height.mas_equalTo(self.contentView.Height/2);
    }];
    
    UILabel *currentLabel = [[UILabel alloc] init];
    currentLabel.text = [NSString stringWithFormat:@"流水号: %@",[_itemizedDict objectForKey:@"dxh"]];
    currentLabel.font = [UIFont systemFontOfSize:13];
    currentLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:14];
    [self.contentView addSubview:currentLabel];
    
    [currentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).with.offset(Margin);
        make.top.equalTo(nameLabel.mas_bottom).with.offset(Margin);
        make.width.mas_equalTo(WIDTH * 0.6);
        make.height.mas_equalTo(self.contentView.Height/2);
    }];

    UILabel *timeLabel = [[UILabel alloc] init];
    timeLabel.text = [_itemizedDict objectForKey:@"addtime"];
    timeLabel.textColor = [UIColor lightGrayColor];
    timeLabel.font = [UIFont systemFontOfSize:13];
    timeLabel.textAlignment = NSTextAlignmentRight;
    timeLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(15.0)];
    [self.contentView addSubview:timeLabel];
    
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right).with.offset(-Margin);
        make.top.equalTo(self.contentView.mas_top).with.offset(Margin);
        make.width.mas_equalTo(WIDTH * 0.7);
        make.height.mas_equalTo(self.contentView.Height/2);
    }];

    UILabel *numberLabel = [[UILabel alloc] init];
    numberLabel.text = [NSString stringWithFormat:@"金额: %@",[_itemizedDict objectForKey:@"jine"]];
    numberLabel.font = [UIFont systemFontOfSize:13];
    numberLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(15.0)];
    numberLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:numberLabel];
    
    [numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(timeLabel.mas_bottom).with.offset(Margin);
        make.right.equalTo(self.contentView.mas_right).with.offset(-Margin);
        make.width.mas_equalTo(WIDTH * 0.3);
        make.height.mas_equalTo(self.contentView.Height / 2);
    }];
}

@end
